import { Injectable, NotFoundException } from '@nestjs/common';
import * as fs from 'fs'
import * as path from 'path';

@Injectable()
export class DocumentService {
    async getMarkdownDocument(type: string): Promise<string> {
        try {
            return await fs.readFileSync(path.join(__dirname, '../../' , `/public/doc/${type}.md`), 'utf-8')
        } catch {
            throw new NotFoundException('文档不存在')
        }
    }
}
